﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using mbhxnaengine.Code.Utilities;

namespace mbhxnaengine.Code.GameObject
{
    class GOSprite : GameObject
    {
        // The texture associated with this sprite.
        //
        public Texture2D mTexture;

        // The colour to tint the sprite with
        //
        private Color mColour;

        // Loads all the cotent needed for the sprite.
        //
        public override void LoadContent(String fileName)
        {
            mTexture = GameObjectManager.pInstance.pContentManager.Load<Texture2D>(fileName);
            mColour = Color.White;
        }

        // Implementation of GameObject abstract method.
        //
        public override void Update(GameTime gameTime)
        {

        }

        // Implementation of GameObject abstract method.
        //
        public override void Render(SpriteBatch batch)
        {
            batch.Draw(mTexture,
                       new Vector2(mPosition.X + (mTexture.Width * 0.5f), mPosition.Y + (mTexture.Height * 0.5f)), 
                       null,
                       mColour,
                       pRotation,
                       new Vector2(mTexture.Width * 0.5f, mTexture.Height * 0.5f),
                       mScale,
                       SpriteEffects.None,
                       0);
        }

        // Property accessor for the colour
        //
        public Color pColour
        {
            get
            {
                return mColour;
            }
            set
            {
                mColour = value;
            }
        }
    }
}
